#ifndef GAMECONTROL_H
#define GAMECONTROL_H

#include <QObject>
#include "robot.h"
#include "userplayer.h"
#include "cards.h"
#include "player.h"

class GameControl : public QObject
{
    Q_OBJECT
public:
    // 游戏状态
    enum GameStatus
    {
        DispatchCard,
        CallingLord,
        PlayingHard
    };
    // 玩家状态
    enum PlayerStatus
    {
        ThinkingForCallLord,
        ThinkingForPlayLord,
        Winning
    };
    // 初始化 玩家
    void playerInit();
    //得到玩家对象
    Robot* getLeftRobat();
    Robot* getRightRobat();
    UserPlayer* getUserPlayer();

    void setCurrentPlayer(Player* player);
    Player* getCurrentPlayer();
    //得到出牌玩家和刚打出的牌
    Player* getPendPlayer();
    Cards getPendCards();

    //初始化扑克牌
    void initAllCards();
    // 每次发一张牌
    Card takeOneCard();
    //得到最后三张底牌
    Cards getSurplusCards();
    //重置卡牌数据
    void resetCardData();

    // 准备叫地主
    void startLordCard();
    // 成为地主
    void becomeLord(Player* player);
    // 处理叫地主
    // 处理出牌



    CardList toCardList(Cards::Sortype type = Cards::Desc);
    explicit GameControl(QObject *parent = nullptr);

signals:


private:
    Robot* m_robotLeft;
    Robot* m_robotRight;
    UserPlayer* m_user;
    Player* m_currPlayer;
    Player* m_pendPlayer;
    Cards m_pendCards;
    Cards m_allCards;
};

#endif // GAMECONTROL_H
